#include <stdio.h>
#include <math.h>
double calCharges( double hours );
int main()
 {
	double h; 
	double totalCharges = 0.0; 
	double totalHours = 0.0;
	int i;
	int first=1;
	printf( "Enter the hours parked for 3 cars:");
	for ( i = 1; i <= 3; i++ ) 
	{
	   	scanf( "%lf", &h);
        totalHours+=h;
		
		if (1==i) 
		{
			printf( "%5s%9s%9s\n", "Car", "Hours", "Charge" );
			first=0;
		} 
		totalCharges +=  calCharges( h ) ;
		printf("%5d%9.1f%9.2f\n", i, h, calCharges( h ));
	} 
	printf( "%5s%9.1f%9.2f\n", "TOTAL", totalHours, totalCharges );
	return 0; 
} 
double calCharges( double hours )
{
	double charge; 
	if ( hours < 3.0 ) 
	{
	     charge = 2.0;
	} 
	else if ( hours >= 3 )
	{
	     charge = 2.0 + .5 * ceil( hours - 3.0 );
	} 
    if (charge>10)
	{ 
	     charge = 10.0;
	}
	return charge; 
}